package ru.cannabis.database.hbm;

import org.springframework.jdbc.core.support.JdbcDaoSupport;
import ru.cannabis.database.IPlayerDao;
import ru.cannabis.database.maps.PlayerMapper;
import ru.cannabis.game.player.Player;

/**
 * Created with IntelliJ IDEA.
 * User: Администратор
 * Date: 10.03.13
 * Time: 14:28
 * To change this template use File | Settings | File Templates.
 */
public class PlayerDao extends JdbcDaoSupport implements IPlayerDao
{
    @Override
    public Player getByVkId(String vkId)
    {
        Player result = null;

        try
        {
            result = getJdbcTemplate().queryForObject("select * from account where user_vk_id = ? limit 1", new PlayerMapper(null), vkId);
        }
        catch (Exception e)
        {
            //e.printStackTrace();
        }

        return result;
    }
}
